﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta charset="utf-8" />
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>编辑详细信息</title>
    <link rel="stylesheet" type="text/css" href="../assets/plugins/editor/kindeditor-4.1.10/themes/mycss/ms_angluar.css" />
    <link rel="stylesheet" type="text/css" href="../assets/plugins/bootstrap/css/bootstrap.css" />
    <script type="text/javascript" src="../assets/plugins/angularjs/angular.min.js"></script>
    <link rel="stylesheet" href="../assets/plugins/editor/kindeditor-4.1.10/themes/default/default.css" />
    <script charset="utf-8" src="../assets/plugins/editor/kindeditor-4.1.10/kindeditor.js"></script>
    <script charset="utf-8" src="../assets/plugins/editor/kindeditor-4.1.10/lang/zh_CN.js"></script>

    <script type="text/javascript">
        var testImg = angular.module("detailApp", ["ms.kindeditor"])
        .controller('detailCtr', ['$scope', '$rootScope', function ($scope, $rootScope, $window) {
                $scope.model = {
                    detail:"测试"
                };
                $scope.saveDetail = function () {
                    KindEditor.sync('#textareDetail');
                    alert(document.getElementById('textareDetail').value);
                    
                    $scope.model.detail = document.getElementById('textareDetail').value;
                    }
            }]);
            angular.module("ms.kindeditor",[])
            .directive('msKindeditor',[function(){
                return {
                    restrict:'EA',
                    require:'?ngModel',
                    scope:{
                    },
                    link:function(scope,element,attrs,kindEditorController){
                        var kindeditor;
                        KindEditor.ready(function(K){
                            kindeditor = K.create(element[0], {
                                fullscreenMode: false,
                                width: '100%',
                                height: '700px',
                                minWidth:'50px',
                                resizeType: 2,
                                wellFormatMode: true,
                                fontSizeTable:['9px', '11px','13px', '15px','17px', '19px','20px', '21px','22px', '23px','24px','25px','27px','29px','30px', '31px','32px','40px'],
                                afterChange:function(){
                                   kindEditorController.$setViewValue(this.html());
                                }

                            });

                            kindEditorController.$render=function(){
                                 kindeditor.html(kindEditorController.$viewValue);
                            }
                        });
                    }
                }
            }]);
    </script>


</head>
<body ng-app="detailApp"> 
        <div  style="width:80%; margin-left:auto; margin-right:auto; overflow-y:auto">
            <div ng-controller="detailCtr">
                
                <div>
                    <!-- <ms-kindeditor ng-model="model.detail"></ms-kindeditor> -->
                    <textarea id="textareDetail" ms-kindeditor ng-model="model.detail"></textarea>
                </div>
                <div>
                    <button ng-click="saveDetail()">保存</button>
                </div>
            </div>
        </div>
</body>
</html>





























